package com.wangchao.administrator.zenmechi.ui.loginactivity;

import com.wangchao.administrator.zenmechi.base.IView;

import rx.Subscriber;

/**
 * Created by cbb on 2016/10/18.
 * Email: 1023151857@qq.com
 */
public class LoginPresenter implements LoginContract.Presnter {
    private LoginModle model;
    private LoginContract.View view;
    public LoginPresenter(LoginContract.View view){
        this.view=view;
        this.model=new LoginModle();
    }
    @Override
    public void getLoginInfo(String id) {
        model.query(id, new Subscriber<String>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {
                view.loginFailed("账户名不存在"+e.getMessage());
            }

            @Override
            public void onNext(String s) {
                view.loginSuccess(s);
            }
        });
    }

    @Override
    public void detachView() {

    }

    @Override
    public void attachView(IView view) {

    }
}
